import { ref,reactive,computed } from 'vue'
import { defineStore } from 'pinia'
import { pageEquipments } from "@/api/equipment";

export const useEquipmentStore = defineStore('equipment', () => {


    const equipmentPage = reactive({
        pageNum:1,
        pageSize:12,
        total:0,
        datas: []
    })

    const pageDTO = reactive({
        pageNum:1,
        pageSize:12,
        name:""
    })
    const getEquipmentPage = async ()=>{
        const res = await pageEquipments(pageDTO);
        const data = res.data.data;
        equipmentPage.pageNum = parseInt(data.pageNum);
        equipmentPage.pageSize = parseInt(data.pageSize);
        equipmentPage.total = parseInt(data.total);
        equipmentPage.datas = data.datas;
    }


    return { equipmentPage, getEquipmentPage , pageDTO}
})
